package cn.ruituo.yuhuo;


import java.util.Date;

/**
 * @author <作者>
 * @since <版本>
 */
public class Hotel {
    private String name;
    private String address;

    Zhizhao zhizhao=new Zhizhao("包河区工商局","2018-1-1","2023-12-31","bao9393993933");

    public Hotel(String name, String address) {
        this.name = name;
        this.address = address;
    }

    public void show(){
        System.out.println("这家宾馆位于"+address+",名叫"+name);
        zhizhao.show();
    }

    public void clean(String roomNo){
        //清洁工
        Date date=new Date();
        //方法内部类
        class Cleaner{
            String name;
            public void doClean(){
                System.out.println(name+"正在清洁"+roomNo+",这个房间属于"+Hotel.this.name);
                System.out.println("打扫时间是"+date);
            }
        }
        Cleaner c=new Cleaner();
        c.name="老徐";
        c.doClean();
    }
    //普通内部类
    //可以访问外部类的属性和方法
    public class Zhizhao{
        private String issuingAuthority;
        private String from,to;
        private String no;

        private String name="营业执照";



        public Zhizhao(String issuingAuthority, String from, String to, String no) {
            this.issuingAuthority = issuingAuthority;
            this.from = from;
            this.to = to;
            this.no = no;
        }
        //每个内部类都有一个外部类的引用
        //外部类名.this.
        public void show(){
            System.out.println("号码是"+no+",办法机构是"+issuingAuthority+",期限从"+from+"到"+to+"止");
            System.out.println("发给了"+Hotel.this.name);
        }
    }
    //和外部类独立
    public static class Lifashi{
        public String name;
    }
}
